
<div class="container-fluid">

            <div class="row-fluid">
                <div class="span12">
                    <h3 class="page-title">
                        新闻管理 <small>新闻列表</small>
                    </h3>
                    <ul class="breadcrumb">
                        <li>
                            <i class="icon-home"></i>
                            <a href="index.html">新闻管理</a> 
                            <i class="icon-angle-right"></i>
                        </li>
                        <li><a href="#">新闻列表</a></li>
                      
                    </ul>
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>


            <div class="row-fluid"> 

                <div class="portlet box grey">
                        <div class="portlet-title">
                                <div class="caption"><i class="icon-cogs"></i>新闻列表</div>
                                <div class="actions">
                                  
                                    <a href="<?php echo Yii::app()->createUrl(Yii::app()->params['adminUrl'].'/new/add');?>" class="btn blue"><i class="icon-pencil"></i>添加新闻</a></button> 
                                </div>  
                        </div>
                    
                      
                    <div class="portlet-body">
                          <?php
            $this->widget('bootstrap.widgets.TbGridView', array(
                'id' => 'table-Activity',
                'dataProvider' => $News->search(Yii::app()->user->Alumni_id),
                'filter' => $News,
                'enableHistory' =>'true',
                'htmlOptions' =>array('class'=>'table table-hover'),
                'afterAjaxUpdate' => 'reinstallDatePicker',
                'summaryText' => '<font color="#0066A4"; style="float:right">显示{start}-{end}条.共{count}条记录,当前第{page}页</font>', 
                
                           
                'columns' => array(
//                    array(
//                        'class' => 'CCheckBoxColumn',
//                        'name' => 'id',
//                        'value' => '$data->id',
//                        'selectableRows' => 2,
//                   
                   // ),
                    array(
                        'name' => 'id',
                         'value' => '$data->id',
                    ),
                    array(
                        'name' => 'title',
                        'header'=>'标题',
                        'value' => '$data->title',
                        //'htmlOptions' =>array('style'=>'width:80px;'),
                    ),
                    
                    array(
                        'name' => 'alumni_id',
                        'header'=>'总会名称',
                        'value' => '$data->Alumni->rename',
                    ),

                    array(
                        'name' => 'ctime',
                        'header'=>'发布时间',
                        'value' => 'date("Y-m-d H:i:s",$data->ctime)',
                        'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                        'model' => $News,
                        'attribute' => 'ctime',
                        'language' => 'zh',              
                        'htmlOptions' => array(
                            'id' => 'datepicker_for_due_date',                       
                            'style' => 'height:20px;width:80px;',
                        ),
                        'options' => array(// 
                            'showAnim' =>'slideDown',
                            'dateFormat' => 'yy-mm-dd',
                            'showButtonPanel' => true,
                        )
                            ), true), //
                       
                    ),
                    array(
                        'name' => 'zan_count',
                        'header'=>'点赞数',
                        'value' => '$data->getBackground($data->zan_count)',
                       // 'htmlOptions'=>array('class'=>'label label-important')
                     
                    ),
                    
                    array(
                        'name' => 'fav_count',
                        'header'=>'收藏数',
                        'value' => '$data->getBackground($data->fav_count)',
                       //'htmlOptions'=>array('class'=>'label label-important')
                     
                    ),
                     array(
                        'name' => 'is_hot',
                        'header'=>'是否热点',
                       'value' => '$data->getHot($data->is_hot)',
                        'filter'=>FALSE
                       // 'htmlOptions' =>array('style'=>'width:10px;'),
                    ),
                    
                    array(
                   'header' => '操作',
                   'class' => 'bootstrap.widgets.TbButtonColumn',
                 
                   'template' =>'{view}|{hot}|{edit}|{delete}',

                   'htmlOptions' => array('style' => 'width:180px'),
                   'buttons' => array(
                       'view' => array(
                           'label' => '查看',
                           'url' => 'Yii::app()->createUrl("xyhadm/new/view",
                                   array(
                                           "id"=>$data->id,
                                        ))',
                          'options' => array(
                                    'data-toggle' => 'modal',
                                    'data-target' => '#view', 
                                    'class'=>'btn green mini'
                           ),
                         ),

                        //'edit' =>'$data->is_edit($data->type_id)',
                       'edit'=>array(
                            'label' => '修改',
                             'url' => 'Yii::app()->createUrl("xyhadm/new/edit",
                                   array(
                                           "id"=>$data->id,
                                        ))',
                           'options'=>array('class'=>'label label-success')

                       ),
                       'delete'=>array(
                           'label' =>'删除',
                           'options'=>array(
                                'class'=>'label label-danger'
                           )
                           
                       ),
                       'hot'=>array(
                           'label' =>'设为热点',
                           'url' =>'"javascript:hot(\"".$data->id."\",\"".$data->is_hot."\");"',
                           'options'=>array('class'=>'btn red mini')
                            

                       ),
//                        'hotCancel'=>array(
//                           'label' =>'取消热点',
//                           'url' =>   '"javascript:hot(\"".$data->id."\",\"".$data->status."\");"',
//                           'options'=>array('class'=>'btn blue mini')
//                       )

                     ),      
               ),
                    
                    
                    
                    
           
               
            ),
                
        ));
 
            
            
             Yii::app()->clientScript->registerScript('re-install-date-picker',"
            function reinstallDatePicker(id, data){ 
                $('#datepicker_for_due_date').datepicker(jQuery.extend(jQuery.datepicker.regional['en'],{'dateFormat':'yy-mm-dd'}));//

               
}");
    ?> 
                </div>
                        
                        
               </div>    
            </div>
</div>

<!-- 查看 -->

<div class="modal fade" style="width: 1050px; margin: -10px 0 0 -450px;" id="view"  tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
   <div class="modal-dialog">
        <div class="modal-content" id="prepaidData-content" style="width: 1050px; margin: -10px 0 0 -450px;">
        
            
        </div>      
    </div>  
</div>




<script type="text/javascript">


$(document).ready(function() {    
   
    $('#view').on('hidden.bs.modal',function(e){
        $('div.modal-backdrop.fade.in').remove();
         history.go(0);
    });
    
    
   


});

 function hot(id,is_hot){
        $.fn.yiiGridView.update('table-Activity',{
            type:'POST',
            url:$(this).attr('href'), 
             data:{'id':id,'is_hot':is_hot},
        });
    }



</script>